namespace CIS.Customer
{
    using CISLib;
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class CustomerInfoOtherPage : Page
    {
        protected HyperLink CustomerASBContractHk;
        protected HyperLink CustomerASBEventsHk;
        protected HyperLink CustomerASBReceptionHk;
        protected HyperLink CustomerASBTrainingHk;
        protected HyperLink CustomerCompetitorEventsHk;
        protected HyperLink CustomerCompetitorMeetingHk;
        protected HyperLink CustomerEventsHk;
        protected HyperLink CustomerEVMeetingHk;
        protected HyperLink CustomerNewsPaperHk;
        protected HyperLink CustomerRelationsHk;
        protected HyperLink CustomerResponsibleStaffHk;
        protected HyperLink CustomerVisitingAbroadHk;
        protected Image iBtnCustomer;
        protected ImageButton iBtnGray8;
        protected ImageButton iBtnOrange0;
        protected ImageButton iBtnOrange1;
        protected ImageButton iBtnOrange2;
        protected ImageButton iBtnOrange3;
        protected ImageButton iBtnOrange4;
        protected ImageButton iBtnOrange5;
        protected ImageButton iBtnOrange6;
        protected ImageButton iBtnOrange7;
        protected HyperLink PicHk;
        protected UserPrincipal Principal = null;

        private void iBtnOrange0_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/CIS/Customer/CustomerBasicInfoPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange1_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/CIS/Customer/CustomerInfoPersonalPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange2_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/CIS/Customer/CustomerInfoPreferencePage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange3_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/CIS/Customer/CustomerInfoHealthCostumePage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange4_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/CIS/Customer/CustomerInfoTravelPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange5_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/CIS/Customer/CustomerInfoStudyPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange6_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/CIS/Customer/CustomerInfoWorkPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange7_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/CIS/Customer/CustomerInfoFamilyPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void InitializeComponent()
        {
            this.iBtnOrange0.Click += new ImageClickEventHandler(this.iBtnOrange0_Click);
            this.iBtnOrange1.Click += new ImageClickEventHandler(this.iBtnOrange1_Click);
            this.iBtnOrange2.Click += new ImageClickEventHandler(this.iBtnOrange2_Click);
            this.iBtnOrange3.Click += new ImageClickEventHandler(this.iBtnOrange3_Click);
            this.iBtnOrange4.Click += new ImageClickEventHandler(this.iBtnOrange4_Click);
            this.iBtnOrange5.Click += new ImageClickEventHandler(this.iBtnOrange5_Click);
            this.iBtnOrange6.Click += new ImageClickEventHandler(this.iBtnOrange6_Click);
            this.iBtnOrange7.Click += new ImageClickEventHandler(this.iBtnOrange7_Click);
            base.Load += new EventHandler(this.Page_Load);
        }

        private void InitPage()
        {
            this.SetFromImage();
            this.SetFrom();
            string customerId = base.Request.QueryString["CustomerId"].ToString();
            this.CustomerEVMeetingHk.NavigateUrl = "~/CIS/Customer/OtherCustomerEVMeetingPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerVisitingAbroadHk.NavigateUrl = "~/CIS/Customer/OtherCustomerVisitingAbroadPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerASBEventsHk.NavigateUrl = "~/CIS/Customer/OtherCustomerASBEventsPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerEventsHk.NavigateUrl = "~/CIS/Customer/OtherCustomerEventsPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerRelationsHk.NavigateUrl = "~/CIS/Customer/OtherCustomerRelationsPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerResponsibleStaffHk.NavigateUrl = "~/CIS/Customer/OtherCustomerResponsibleStaffPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerASBReceptionHk.NavigateUrl = "~/CIS/Customer/OtherCustomerASBReceptionPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerCompetitorMeetingHk.NavigateUrl = "~/CIS/Customer/OtherCustomerCompetitorMeetingPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerCompetitorEventsHk.NavigateUrl = "~/CIS/Customer/OtherCustomerCompetitorEventsPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.PicHk.NavigateUrl = "~/CIS/Customer/OtherCustomerPicPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerASBContractHk.NavigateUrl = "~/CIS/Customer/OtherCustomerASBContractPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerASBTrainingHk.NavigateUrl = "~/CIS/Customer/OtherCustomerASBTrainingPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            this.CustomerNewsPaperHk.NavigateUrl = "~/CIS/Customer/OtherCustomerNewsPaperPage.aspx?IsModify=True&CustomerId=" + customerId.ToString();
            if (this.Principal.OwnArea[0].AreaId.ToString() == "a7f26634-10a9-4cb1-aa2c-8c91a8dfdd66")
            {
                this.CustomerNewsPaperHk.Visible = false;
            }
            else
            {
                this.CustomerNewsPaperHk.Visible = true;
            }
        }

        protected override void OnInit(EventArgs e)
        {
            this.InitializeComponent();
            base.OnInit(e);
            this.Principal = this.Context.User as UserPrincipal;
        }

        private void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                this.InitPage();
            }
        }

        private void SetFrom()
        {
            string language = this.Session["language"].ToString();
            string path = base.Server.MapPath("~/CIS/LanguageConfig.xml");
            this.CustomerEVMeetingHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbEVMeeting", language, path);
            this.CustomerVisitingAbroadHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbVisitingAbroad", language, path);
            this.CustomerASBEventsHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbASBEvents", language, path);
            this.CustomerEventsHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbCustomerEvents", language, path);
            this.CustomerRelationsHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbRelations", language, path);
            this.CustomerResponsibleStaffHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbResponsibleStaff", language, path);
            this.CustomerASBReceptionHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbASBReception", language, path);
            this.CustomerCompetitorMeetingHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbCompetitorMeeting", language, path);
            this.CustomerCompetitorEventsHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbCompetitorEvents", language, path);
            this.CustomerASBContractHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbASBContract", language, path);
            this.PicHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbPic", language, path);
            this.CustomerNewsPaperHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbNewsPaperHk", language, path);
            this.CustomerASBTrainingHk.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoOtherPage", "lbASBTrainingHk", language, path);
        }

        private void SetFromImage()
        {
            switch (this.Session["language"].ToString())
            {
                case "cn":
                    this.iBtnCustomer.ImageUrl = "../images/title_customerinfo.jpg";
                    this.iBtnOrange0.ImageUrl = "../images/title_CustomerInfo_lable_1_orange.jpg";
                    this.iBtnOrange1.ImageUrl = "../images/title_CustomerInfo_lable_2_orange.jpg";
                    this.iBtnOrange2.ImageUrl = "../images/title_CustomerInfo_lable_3_orange.jpg";
                    this.iBtnOrange3.ImageUrl = "../images/title_CustomerInfo_lable_4_orange.jpg";
                    this.iBtnOrange4.ImageUrl = "../images/title_CustomerInfo_lable_5_orange.jpg";
                    this.iBtnOrange5.ImageUrl = "../images/title_CustomerInfo_lable_6_orange.jpg";
                    this.iBtnOrange6.ImageUrl = "../images/title_CustomerInfo_lable_7_orange.jpg";
                    this.iBtnOrange7.ImageUrl = "../images/title_CustomerInfo_lable_8_orange.jpg";
                    this.iBtnGray8.ImageUrl = "../images/title_CustomerInfo_lable_9_Gray.jpg";
                    break;

                case "en":
                    this.iBtnCustomer.ImageUrl = "../images/title_customerinfoEn.jpg";
                    this.iBtnOrange0.ImageUrl = "../images/title_CustomerInfoEn_lable_1_orange.jpg";
                    this.iBtnOrange1.ImageUrl = "../images/title_CustomerInfoEn_lable_2_orange.jpg";
                    this.iBtnOrange2.ImageUrl = "../images/title_CustomerInfoEn_lable_3_orange.jpg";
                    this.iBtnOrange3.ImageUrl = "../images/title_CustomerInfoEn_lable_4_orange.jpg";
                    this.iBtnOrange4.ImageUrl = "../images/title_CustomerInfoEn_lable_5_orange.jpg";
                    this.iBtnOrange5.ImageUrl = "../images/title_CustomerInfoEn_lable_6_orange.jpg";
                    this.iBtnOrange6.ImageUrl = "../images/title_CustomerInfoEn_lable_7_orange.jpg";
                    this.iBtnOrange7.ImageUrl = "../images/title_CustomerInfoEn_lable_8_orange.jpg";
                    this.iBtnGray8.ImageUrl = "../images/title_CustomerInfoEn_lable_9_Gray.jpg";
                    break;
            }
        }
    }
}

